class Solution:
    def minChanges(self, n: int, k: int) -> int:
        if k > n:
            return -1
        ans = 0
        while n > 0:
            nl = n & 1
            kl = k & 1
            if nl < kl:
                return -1
            if nl > kl:
                ans += 1
            n >>= 1
            k >>= 1
        return ans


s = Solution()
print(s.minChanges(n=21, k=21))
print(s.minChanges(n=14, k=13))
